Skip to content

fix: allow deleting last clip per recording segment in Studio Mode#1848

Merged
richiemcilroy merged 1 commit into
CapSoftware:mainfrom
ManthanNimodiya:fix/clip-deletion-paused-recording
May 20, 2026
Merged

fix: allow deleting last clip per recording segment in Studio Mode#1848
richiemcilroy merged 1 commit into
CapSoftware:mainfrom
ManthanNimodiya:fix/clip-deletion-paused-recording

Conversation

@ManthanNimodiya
Copy link
Copy Markdown
Contributor

@ManthanNimodiya ManthanNimodiya commented May 20, 2026

What does this PR fix?

Fixes #1695, users were unable to delete clips in Studio Mode after pausing a camera-only recording.

Root cause

deleteClipSegment in context.ts had a guard that prevented deletion when fewer than 2 timeline segments shared the same recordingSegment index (i.e., the same pause interval).
This meant the "last" clip from any paused segment became permanently undeletable, even when other segments remained in the timeline.

The ConfigSidebar.tsx Delete button used the same incorrect condition to disable itself.

Additionally, the condition !segment.recordingSegment === undefined in the original guard was always false (boolean vs. undefined comparison) — dead code that never fired.

Changes

  • context.ts: Updated deleteClipSegment guard — now only blocks deletion when it would leave the timeline completely empty (segments.length < 2), rather than blocking when it's the last clip of a specific recording segment.
  • ConfigSidebar.tsx: Updated the Delete button disabled prop to use the same corrected logic.

Testing

  1. Record with Camera Only enabled, pause and resume multiple times.
  2. Open the recording in Studio Mode.
  3. Select a clip from a paused segment and press Delete (or use the Delete button in the sidebar).
  4. Verify all clips except the very last one can be deleted.

Greptile Summary

This PR fixes a bug where clips in a paused camera-only recording segment could not be deleted in Studio Mode. The root cause was a guard that blocked deletion whenever fewer than two clips shared the same recordingSegment index, and a dead-code condition (!segment.recordingSegment === undefined) that always evaluated to false.

  • context.ts: The deleteClipSegment guard now only prevents deleting when one segment remains in the entire timeline (segments.length < 2), removing both the dead boolean-vs-undefined comparison and the per-recording-segment filter.
  • ConfigSidebar.tsx: The Delete button's disabled prop is updated to match the new guard, ensuring UI state stays in sync with the action's actual behavior.

Confidence Score: 5/5

The change is safe to merge — it relaxes an overly strict guard and aligns the UI disabled state with the action logic.

Both modified sites (the action guard and the button disabled prop) are now consistent with each other and with the intended behavior: only the very last timeline segment is protected from deletion. The removed dead-code condition never fired, so its removal has no side effects.

No files require special attention.

Important Files Changed

Filename Overview
apps/desktop/src/routes/editor/context.ts Guard in deleteClipSegment simplified: dead-code boolean-vs-undefined comparison removed and per-recording-segment filter replaced with a global segment count check (< 2).
apps/desktop/src/routes/editor/ConfigSidebar.tsx Delete button disabled prop updated to mirror the corrected guard in context.ts, now using total segment count instead of per-recording-segment count.

Reviews (1): Last reviewed commit: "fix: allow deleting last clip per record..." | Re-trigger Greptile

@superagent-security superagent-security Bot added contributor:verified Contributor passed trust analysis. pr:verified PR passed security analysis. labels May 20, 2026
@ManthanNimodiya
Copy link
Copy Markdown
Contributor Author

hey @richiemcilroy, have a look at this when you get chance and let me know if any changes required

@richiemcilroy richiemcilroy merged commit acdd6dd into CapSoftware:main May 20, 2026
15 of 16 checks passed
@ManthanNimodiya ManthanNimodiya deleted the fix/clip-deletion-paused-recording branch May 21, 2026 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor:verified Contributor passed trust analysis. pr:verified PR passed security analysis.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Paused Recording in Studio Mode => Can't delete Clips in Timeline?

2 participants